#include <QtPlugin>

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QSpinBox>
#include <QWidget>
#include <QPushButton>
#include <QLayout>
#include <QGridLayout>
#include <QColor>
#include <QLabel>
#include <QFileDialog>
#include <QMouseEvent>
#include <QMessageBox>
#include <QLineEdit>
#include <QGroupBox>

#include <opencv/cv.h>
#include <opencv/highgui.h>

#include <time.h>

#include "QCVModuleInterface.h"
#include "QCVModuleHandlerInterface.h"

#include "CLUT.h"
#include "PlotColors.h"

#ifndef MODULE_X
#define MODULE_X

class ModuleCLUTSurvey:public QObject,QCVModuleInterface
{
  Q_OBJECT
	Q_INTERFACES(QCVModuleInterface)
	
	public:
		void init(QCVModuleHandlerInterface * parent);
		void free();

		cv::Mat & process();
		void setInput(int n,const cv::Mat & m);

		QWidget* widget();
		QString getName();
		int nbInputs();
		QString help(int id);
		bool setParams(QString params);
		QString getParams();

		QCVModuleInterface * clone();

	private slots:
		void s_loadFuzzyCLUT();
		void s_saveResults();
		void s_askMe();
		void s_clearResults();
		
	private:  
		QWidget * win;
		QString results;
		
		QVBoxLayout * layout;

		QPushButton * pb_clear;
		QPushButton * pb_askMe;
		QPushButton * pb_loadFuzzyCLUT;
		QPushButton * pb_saveResults;
		QSpinBox * sb_nbColorsAsked;
		QLineEdit * le_question;
		QGroupBox * gb_flops_params;
		
		PlotColors * plotcolors;
		
		cv::Mat clut;
		cv::Mat fuzzyclut;
		
		uchar color;
		
		QCVModuleHandlerInterface * parent;
};

#endif
